﻿using BatchJob.Admin.Model;
using FirstFloor.ModernUI.Presentation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BatchJob.Admin.ViewModel
{
    public class ConnVM
    {
        public Connection Connection { get; set; }

        /// <summary>
        /// 提示信息
        /// </summary>
        public string Info { get; set; }


        public bool NeedShowInfo { get; set; }

        /// <summary>
        /// 是否已连接
        /// </summary>
        public bool IsConnected { get; set; }

        public ConnVM()
        {
            this.Connection = new Connection();
        }
        public void Connect()
        {
            this.Info = "尝试连接,请稍候";
            this.NeedShowInfo = true;

            if (Connection.Connect(this.Connection))
            {
                this.IsConnected = true;
                this.NeedShowInfo = false;
            }
            else
            {
                this.Info = "连接失败,请检查";
            }
        }
    }
}
